package TestClasser;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import ControlLayer.*;
import ModelLayer.Product;
import ModelLayer.SaleOrder;

public class SaleOrderCtrTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	
	public void test() {
		fail("Not yet implemented");
	}
	
	
	public void testCreateSaleOrder() 
	{
	System.out.println("Creater en SaleOrdeer");
	SaleOrderCtr soc = SaleOrderCtr.getInstance();
	soc.createSaleOrder("hej", "hej", 1, 1, 1, 1);
	System.out.println("Du er noget hertil ");
	
	}
	
	public void deleteSaleOrder()
	{
		System.out.println("Sletter en ordrer");
		SaleOrderCtr soc = SaleOrderCtr.getInstance();
		soc.deleteSaleOrder(1);
		if(soc.findSaleOrderId(1) != null)
		{
			System.out.println("Virker ikke");
		}
		else {
			System.out.println("SaleOrderen er blevet fjernet");
		}
	}
	
	@Test
     public void testFindSaleOrderId() 
	 {
		
     	System.out.println("Finder en saleOrder vha. ID.");
        SaleOrderCtr soc = SaleOrderCtr.getInstance();
        SaleOrder so = soc.findSaleOrderId(1);
        if(so != null)
        {
        	System.out.println(""+so.getSaleOrderId()+"");
        }
        else {
        	
        }
                  		
             }
}